package com.spotmanger.project.modular.spottable.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.spotmanger.project.modular.spottable.entity.SpottableRepairedNewEntity;
import com.spotmanger.project.modular.spottable.mapper.SpottableRepairedNewMapper;
import com.spotmanger.project.modular.spottable.service.SpottableRepairedNewService;
import org.springframework.stereotype.Service;


@Service("spottableRepairedNewService")
public class SpottableRepairedNewServiceImpl extends ServiceImpl<SpottableRepairedNewMapper, SpottableRepairedNewEntity> implements SpottableRepairedNewService {

    /**
     * 以TBBH为主,结合 LambdaQueryWrapper的模糊搜索方法。
     */
    @Override
    public LambdaQueryWrapper<SpottableRepairedNewEntity> searchByTBBH(SpottableRepairedNewEntity spottableRepairedNew) {
        LambdaQueryWrapper<SpottableRepairedNewEntity> queryWrapper = Wrappers.lambdaQuery();
        if (spottableRepairedNew.getTBBH() != null) {
            queryWrapper.like(SpottableRepairedNewEntity::getTBBH, spottableRepairedNew.getTBBH());
        } else {
            return queryWrapper;
        }
        return queryWrapper;
    }
}